The stata module (pystata.stata)

您所在的位置:网站首页 stata variable type The stata module (pystata.stata)

The stata module (pystata.stata)

2024-07-11 10:32| 来源: 网络整理| 查看: 265

Load a pandas DataFrame into Stata’s memory, making it the current dataset.

Each column of the DataFrame will be stored as a variable. If the column type conforms to a Stata variable type, the variable type will be used in Stata. Otherwise, the column will be converted into a string variable in Stata.

The variable names will correspond to the column names of the DataFrame. If the column name is a valid Stata name, it will be used as the variable name. If it is not a valid Stata name, a valid variable name is created by using the makeVarName() method of the SFIToolkit class in the Stata Function Interface (sfi) module.

If there is a dataset in memory and it has been changed since it was last saved, an attempt to load a DataFrame into Stata will raise an exception. The force argument will force loading of the DataFrame, replacing the dataset in memory.

Parameters

df (pandas DataFrame) – The DataFrame to be loaded.

force (bool, optional) – Force loading of the DataFrame into Stata. Default is False.

Raises

SystemError – This error can be raised if there is a dataset in memory that has been changed since it was last saved, and force is False.



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3